package cate.game.role.world.invite;

import cate.common.game.invite.InviteDef;
import cate.common.table.invite.row.InviteLoginRow;
import cate.game.GameBody;
import cate.game.role.world.invite.comm.InviteNumTask;
import easy.java.dev.note.NoteField;
import easy.java.practice.errorcode.EcException;

import java.util.ArrayList;
import java.util.List;

public class InviteLoginTask extends InviteNumTask {

    @NoteField("受邀人ID列表")
    public List<String> inviteeIds = new ArrayList<>();

    @Override
    protected int getOperationSub() {
        return InviteDef.OPERATION_SUB_LOGIN;
    }

    @Override
    protected int getRequiredNumForReward(GameBody game, int index) {
        return index;
    }

    @Override
    protected String getRewardCnf(GameBody game, int tid) {
        InviteLoginRow row = game.table.invite.login.get(tid);
        if(row == null) {
            throw new EcException("找不到第"+tid+"项InviteLoginRow");
        }
        return row.rwdCnf;
    }

    @Override
    public void reset() {
        super.reset();
        this.inviteeIds.clear();
    }
}
